class Heartbeat:
    def __init__(self):
        self.state = 0
    
    def update(self):
        self.state = self.state ^ 1
    
    def tick(self):
        self.update()
        self.update()

    def get(self):
        return self.state
    
    def __repr__(self):
        return self.state